import { SET_LIST_SCROLL_STATE } from "./type";

export function listScroll(
  state: boolean = false,
  action: { type: string; data: boolean }
) {
  if (action.type === SET_LIST_SCROLL_STATE) {
    return action.data;
  } else {
    return state;
  }
}

export function setListScroll(data: boolean) {
  return {
    type: SET_LIST_SCROLL_STATE,
    data,
  };
}

export const getListScrollState =
  () =>
  (state: any): boolean =>
    state.listScroll;
